home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
apps
/
630
/
doc
/
gs241.bug
< prev
next >
Wrap
Text File
|
1992-05-05
|
4KB
|
122 lines
There follows a patch to gdevgif.c that fixes the problem when used on
"big endian" machines (e.g. Suns). The image dimensions are stored as short
ints in LSB order in GIF files, so on big endian machines the bytes that
make up the shorts need to be swapped. The patch also fixes the
"redeclaration of gif_print_page" error given by some compilers.
James Pearson
+------------------------------------------------------------------------+
Dept. Photogrammetry & Surveying INTERNET: j.pearson@ps.ucl.ac.uk
University College London UUCP: ...!uknet!cs.ucl!jcpearso
Gower Street JANET: j.pearson@uk.ac.ucl.ps
London WC1E 6BT
England
*** gdevgif.c.orig Sat Apr 25 18:40:51 1992
--- gdevgif.c Sat Apr 25 18:42:37 1992
***************
*** 300,308 ****
}
}
/* Write a page to a file in GIF format. */
! int
gif_print_page(gx_device_printer *pdev, FILE *file)
{ int raster = gdev_prn_bytes_per_scan_line(pdev);
int height = pdev->height;
--- 300,327 ----
}
}
+ #if arch_is_big_endian
+ union scombine{
+ ushort num;
+ uchar bytes[2];
+ };
+ private void
+ sswap(ushort *ival, ushort *oval)
+ {
+ union scombine tmp;
+
+ tmp.num = *ival;
+ /**interchange the bytes**/
+ tmp.bytes[0] ^= tmp.bytes[1];
+ tmp.bytes[1] ^= tmp.bytes[0];
+ tmp.bytes[0] ^= tmp.bytes[1];
+
+ *oval = tmp.num;
+ }
+ #endif arch_is_big_endian
/* Write a page to a file in GIF format. */
! private int
gif_print_page(gx_device_printer *pdev, FILE *file)
{ int raster = gdev_prn_bytes_per_scan_line(pdev);
int height = pdev->height;
***************
*** 330,335 ****
--- 349,358 ----
/* width must be on byte */
/* boundry */
header.height = height;
+ #if arch_is_big_endian
+ sswap(&header.height,&header.height);
+ sswap(&header.width,&header.width);
+ #endif
/* header.flags.globalcolor = TRUE; */
/* header.flags.colorres = depth-1; */
/* header.flags.sort = FALSE; */
***************
*** 360,365 ****
--- 383,394 ----
header_desc.top_pos = 0;
header_desc.width = raster * (8/depth); /*pdev->width;*/
header_desc.height = height;
+ #if arch_is_big_endian
+ sswap(&header_desc.left_pos,&header_desc.left_pos);
+ sswap(&header_desc.top_pos,&header_desc.top_pos);
+ sswap(&header_desc.width,&header_desc.width);
+ sswap(&header_desc.height,&header_desc.height);
+ #endif
/* header_desc.flags.localcolor = FALSE; */
/* header_desc.flags.interlace = FALSE; */
/* header_desc.flags.sort = FALSE; */
----------------------------------------------------------
> >thanks for your reply. I tried your suggestion and compiled gs24 without
> >optimization. It didn't change a bit. I then narrowed down the problem
> >to the gs_init.ps script. By adding junk lines I discovered that the
> >problem occurs towards the end of this script at a line consisting of
>
> > scrinit
> ^^^^^^^
>
> I'm sorry this should have been "setscreen".
There is a bug in the halftone screen logic in Ghostscript 2.4.1 (and
2.4 also) that may cause it to fail under some conditions for
high-resolution printers. To fix this, change lines 234-235 of
gxht.c from
if ( num_cached == size && num_cached <= max_cached_tiles / 2 )
{ /* We can afford to replicate every tile vertically, */
to
if ( num_cached == size &&
tile_bytes * num_cached <= max_ht_bits / 2
)
{ /* We can afford to replicate every tile vertically, */
Please let me know if this fixes (or doesn't fix) the problem.
L. Peter Deutsch :: Aladdin Enterprises :: P.O. box 60264, Palo Alto, CA 94306
ghost@aladdin.com, ...decwrl!aladdin!ghost ; 415-322-0103 8-9 AM M-F/msg
"Implementation is the sincerest form of flattery."